/*
 * virtualdevicevariable_test.h
 *
 *  Created on: 10/01/2012
 *      Author: rbender
 */

#include "virtualdevicevariable_test.h"
using namespace xvd;

void VirtualDeviceVariable_SetsAndGets::Test(VirtualDeviceTestRunner* runner)
{
	VirtualDeviceVariable_Test* test = static_cast<VirtualDeviceVariable_Test*>(runner);
	test->m_Variable->value() = "VALUE";
	XVD_ASSERT_EQUAL(test->m_Variable->name(), "NAME");
	XVD_ASSERT_EQUAL(test->m_Variable->value(), "VALUE");
	XVD_ASSERT_EQUAL(test->m_Variable->type(), "TYPE");
}

void VirtualDeviceVariable_ConstructorAndDestructor::Test(VirtualDeviceTestRunner* runner)
{
    VirtualDeviceVariable v("NAME", "TYPE");
    v.value() = "VALUE";
    XVD_ASSERT_EQUAL(v.value(), "VALUE");
    VirtualDeviceVariable v2(v);
    XVD_ASSERT_EQUAL(v2.value(), "VALUE");
}

VirtualDeviceVariable_Test::VirtualDeviceVariable_Test() :
        VirtualDeviceTestRunner("VirtualDeviceVariable")
{
	this->Add(new VirtualDeviceVariable_SetsAndGets());
	this->Add(new VirtualDeviceVariable_ConstructorAndDestructor());
}

void VirtualDeviceVariable_Test::Prepare()
{
	m_Variable.reset(new VirtualDeviceVariable("NAME", "TYPE"));
}

void VirtualDeviceVariable_Test::Terminate()
{
}
